<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            background-color: antiquewhite;

        }


        li {
            list-style: none;
        }

        ul {
            padding: 0;
            margin: 0;
        }

        .box {
            display: flex;
            flex-wrap: wrap;
            gap: .5rem;
        }

        .list {
            /* 宽高比 */
            aspect-ratio: 1 / 1;
            /* 一行4个 */
            flex-basis: calc(25% - 1.5rem / 4);
        }

        img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }
    </style>
</head>

<body>
    <!-- 传统方法需要三层元素，并且利用的是padding的百分比计算值是相对于宽度计算的特性。 -->
    <ul class="box">
        <li class="list">
            <img src="../images/1.jpg" />
        </li>
        <li class="list">
            <img src="../images/1.jpg" />
        </li>
        <li class="list">
            <img src="../images/1.jpg" />
        </li>
        <li class="list">
            <img src="../images/1.jpg" />
        </li>
        <li class="list">
            <img src="../images/1.jpg" />
        </li>
        <li class="list">
            <img src="../images/1.jpg" />
        </li>
    </ul>
</body>

</html>